﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Webdisk;

namespace Webdisk_New
{
    public class Confirmation
    {
        Random FontType = new Random();//全局随机数

        private void IdentifyingCode(Label label)//验证码
        {
            int num = FontType.Next(0, 10);//随机数字
            int Size = FontType.Next(22, 25);//随机大小
            int Type = FontType.Next(0, 12);//随机样式（下划线啊什么鬼的）
            int FontFa = FontType.Next(0, 6);//随机字体（微软雅黑啊什么鬼的）
            Random rand1 = new Random();
            Color Col = Color.FromArgb(rand1.Next(256), rand1.Next(256), rand1.Next(256));//随机颜色
            label.Text = num + "";
            label.ForeColor = Col;//字体颜色
            float size = label.Font.Size;//字体大小
            FontFamily myFontFamily = new FontFamily("微软雅黑"); //采用哪种字体
            try
            {
                if (FontFa == 0)
                {
                    myFontFamily = new FontFamily("Comic Sans MS"); //采用哪种字体

                }
                else if (FontFa == 1)
                {
                    myFontFamily = new FontFamily("宋体"); //采用哪种字体

                }
                else if (FontFa == 2)
                {
                    myFontFamily = new FontFamily("Gabriola"); //采用哪种字体

                }
                else if (FontFa == 3)
                {
                    myFontFamily = new FontFamily("Gabriola"); //采用哪种字体

                }
                else if (FontFa == 4)
                {
                    myFontFamily = new FontFamily("仿宋"); //采用哪种字体

                }
                else if (FontFa == 5)
                {
                    myFontFamily = new FontFamily("黑体"); //采用哪种字体

                }
                else if (FontFa == 5)
                {
                    myFontFamily = new FontFamily("楷体"); //采用哪种字
                }
            }
            catch
            {
                return;
            }

            if (Type == 0)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Italic);//普通倾斜
            }
            else if (Type == 1)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Underline);//普通下划线
            }
            else if (Type == 2)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Strikeout);//普通中线
            }
            else if (Type == 3)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Strikeout);//普通中线
            }
            else if (Type == 4)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Regular);//普通
            }
            else if (Type == 5)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Bold);//加粗
            }
            else if (Type == 6)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Bold | FontStyle.Italic);//加粗+倾斜
            }
            else if (Type == 7)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Bold | FontStyle.Underline);//加粗+下划线
            }
            else if (Type == 8)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Bold | FontStyle.Strikeout);//加粗+中线
            }
            else if (Type == 9)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Bold | FontStyle.Strikeout | FontStyle.Underline);//加粗+中线+下划线
            }
            else if (Type == 10)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Regular | FontStyle.Strikeout | FontStyle.Underline);//普通+中线+下划线
            }
            else if (Type == 11)
            {
                label.Font = new Font(myFontFamily, Size, FontStyle.Italic | FontStyle.Strikeout | FontStyle.Underline);//倾斜+中线+下划线
            }



        }


    }
}
